﻿using CardPlay.Model.CardModel;

namespace CardPlay.Model.GameModel.Actions
{
    public class RemoveCardAction : CardAction
    {
        public RemoveCardAction(CardGame cardGame, PartLocation location) : base(cardGame, location)
        {
        }

        protected override void OnExecute()
        {
            _removedCard = Card;
            CardGame.PileAt(Location).RemoveCardAt(Location.Index);
        }
        
        protected override void OnReverse()
        {
            CardGame.PileAt(Location).InsertCard(Location.Index, _removedCard);
        }
        
        private Card _removedCard;
    }
}
